package controleur;

import java.awt.event.ActionEvent;

import javax.swing.Action;

import vue.PanneauPrincipal;


import model.Environnement;

public class Fleche extends ActionButton{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Environnement env = null;
	private int dir = 0;
	private PanneauPrincipal panPrinc = null;

	public Fleche(String fleche, PanneauPrincipal panneauPrincipal, Environnement env, int dir) {
		super(env);
		this.env = env;
		this.dir = dir;
		this.panPrinc = panneauPrincipal;
		putValue( Action.NAME, fleche);
		putValue( Action.SHORT_DESCRIPTION, "Lance le jeu de la vie..." );
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		switch(dir)
		{
		case 1 :
			panPrinc.goLeft(env);
			break;
		case 2 :
			panPrinc.goUp(env);
			break;
		case 3 :
			panPrinc.goRigth(env);
			break;
		case 4 :
			panPrinc.goDown(env);
			break;
		}
	}
}
